# coding: utf-8

def user_dtos(users):
    if not users:
        return []
    return list(map(lambda t: user_dto(t), users))


def user_dto(t):
    return {'id': t.id, 'avatar': t.avatar, 'nickname': t.nickname}


def success(data):
    return {'code': 0, 'data': data}
